package com.yanfei.zero.apis;

import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.SseEmitter;

import com.yanfei.zero.application.handler.lock.AddLock;
import com.yanfei.zero.application.handler.log.AddLog;
import com.yanfei.zero.application.handler.secret.IgnoreDecrypt;
import com.yanfei.zero.domain.user.model.User1;
import com.yanfei.zero.domain.user.model.perms.Auth;
import com.yanfei.zero.domain.user.repository.User1Mapper;
import com.yanfei.zero.domain.user.repository.User1Repository;
import com.yanfei.zero.infrastructure.config.DeveloperProperty;

import cn.dev33.satoken.stp.SaTokenInfo;
import cn.dev33.satoken.stp.StpUtil;
import cn.dev33.satoken.util.SaResult;
import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.transaction.Transactional;
import jakarta.validation.Valid;

@RestController
@Tag(name="秒杀")
//@Auth(id=1000,name="用户")
@RequestMapping("order")
public class SeckillController {
	
	@Autowired  
    private User1Mapper user1Mapper;  
	
	@Autowired
	private User1Repository user1Repository;

	@Operation(summary = "下单")
    @PostMapping("/secKill")
    @IgnoreDecrypt
//    @AddLog
    // @RateLimiter(key = "tets")
//    @Encrypt
    Object order(@Valid @RequestBody User1 user1) {
		// 1 check the whether user has the privilege (logined)
		//  2 check the product 
		// 3 check the seckill time
		// 4 check whether the user has ordered
		// 5 check the stock of the product
        return user1;
    }
	



}
